package genedit.controller.interfaceActions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;

/**
 * Akcija zadužena za gašenje aplikacije.
 * 
 * @author Nikola
 * @version 1.0 5/10/13
 */
public class GExitA extends AbstractAction {
	private static final long serialVersionUID = 1L;

	protected static GExitA exit = null;

	protected GExitA() {
		putValue(NAME, "Exit");
		putValue(SHORT_DESCRIPTION, "Exit");
		putValue(SMALL_ICON, new ImageIcon("resources/icons/close.png"));
		putValue(MNEMONIC_KEY, KeyEvent.VK_X);
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_MASK));
	}

	public static AbstractAction getInstance() {
		if (exit == null)
			exit = new GExitA();
		return exit;
	}

	/**
	 * Akcija gasi aplikaciju.
	 */
	@Override
	public void actionPerformed(ActionEvent arg0) {
		System.exit(0);
	}

}